﻿using System.Diagnostics.Contracts;

namespace BlindData
{
	public static class NegativeGenerator
	{
		/// <summary>
		/// Returns a negative random int.
		/// </summary>
		/// <returns></returns>
		public static int Negative(this INext<int> next)
		{
			Contract.Requires(next != null);

			return next.Between(int.MinValue, -1);
		}

		/// <summary>
		/// Returns a negative random long.
		/// </summary>
		/// <returns></returns>
		public static long Negative(this INext<long> next)
		{
			Contract.Requires(next != null);

			return next.Between(long.MinValue, -1);
		}

		/// <summary>
		/// Returns a negative random double.
		/// </summary>
		/// <returns></returns>
		public static double Negative(this INext<double> next)
		{
			Contract.Requires(next != null);

			return next.Between(double.MinValue, -1 * double.Epsilon);
		}

		/// <summary>
		/// Returns a negative random float.
		/// </summary>
		/// <returns></returns>
		public static float Negative(this INext<float> next)
		{
			Contract.Requires(next != null);

			return next.Between(float.MinValue, -1 * float.Epsilon);
		}

		/// <summary>
		/// Returns a negative random decimal.
		/// </summary>
		/// <returns></returns>
		public static decimal Negative(this INext<decimal> next)
		{
			Contract.Requires(next != null);

			return next.Between(decimal.MinValue, (decimal)(-1 * double.Epsilon));
		}
	}
}
